#include <string>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>

#include "http_single.h"

#if 1

//CHttpSingle* CHttpSingle::m_pInstance = NULL;
CHttpSingle* CHttpSingle::m_pInstance = CHttpSingle::GetInstance();
CHttpSingle::CGarbo CHttpSingle::Garbo;   //这个很重要


#endif

#if 0
class CHttpSingle
{ 
    // 其它成员  
public:  
    static CHttpSingle* GetInstance()
    {
        static CHttpSingle inst;
        return &inst;
    }

    int test01();
private:  
    CHttpSingle(){ printf("0003\n"); };
    ~CHttpSingle(){ printf("0004\n"); };

             CHttpSingle( const CHttpSingle& ){};
            //CHttpSingle& operate = ( const CHttpSingle& ){};



};
#endif

CHttpSingle* CHttpSingle::GetInstance()
{
    if ( m_pInstance == NULL ) // first call
        m_pInstance = new CHttpSingle();
    return m_pInstance;
}

CHttpSingle::CHttpSingle()
{ 
    printf("0003\n"); 
};
CHttpSingle::~CHttpSingle()
{ 
    printf("0004\n"); 
};  

int CHttpSingle::test01()
{
    printf("001\n");
    return 0;
}

using namespace std; 

void doit_itm(string* s)
{
    *s=string("BNGHJMKL");
}

void doit(string* s)
{
    s[0][0]='z';
    s[0]=string("hgsdbadgsfdsafsadf");
    s[1]=string("123456789");
    s[0][4]='b';
     s[1][4]='b';

    doit_itm(&s[1]);
}
#if 1
int main()
{

    def_DEV_PART_STATUS dev_part_status;
    dev_part_status.byte=0;
    dev_part_status.bits.D1=1;
    printf("ggg001;%02X\n",dev_part_status.byte);
    //return 0;
    CHttpSingle::GetInstance()->test01();

    string strurl[2]={"dfsdf","ygsf"};	//qiniu
    doit(strurl);
    printf("%s\n",strurl[0].c_str());
    printf("%s\n",strurl[1].c_str());

    int ncount=5;
    bool blflag1=false;
    bool blflag2=true;
    switch(ncount)
    {
        case 1:
            printf( "%s;%s;%d;%d\n", __FILE__, __func__, __LINE__, blflag1 );
            break;
        case 2:
            printf( "%s;%s;%d;%d\n", __FILE__, __func__, __LINE__, blflag1 );
            break;
        case 5:
            printf( "%s;%s;%d;%d\n", __FILE__, __func__, __LINE__, blflag1 );
            if(false==blflag2)
            {
                printf( "%s;%s;%d;%d\n", __FILE__, __func__, __LINE__, blflag1 );
                break;
            }
            if(false==blflag1)
            {
                printf( "%s;%s;%d;%d\n", __FILE__, __func__, __LINE__, blflag1 );
                break;
            }
            printf( "%s;%s;%d;%d\n", __FILE__, __func__, __LINE__, blflag1 );
            break;
        case 6:
            printf( "%s;%s;%d;%d\n", __FILE__, __func__, __LINE__, blflag1 );
            break;
        case 10:
            printf( "%s;%s;%d;%d\n", __FILE__, __func__, __LINE__, blflag1 );
            break;

    }

}
#endif